<?php  

class TianjaihuodongTable extends We7Table {

    protected $tableName;

    private $page;

    public function __construct(){

        parent::__construct();
        $this->tableName = "szxh_nmyx_activeexpirty_actionsort";
        $this->page = '';
    }
    public function getList($page = 1) {
        $size = 2;
        $list = $this->query
                     ->from($this->tableName)
                     ->orderby('uid', 'DESC')
                     ->page($page, $size)
                     ->getall();
        $total = $this->query->getLastQueryTotal();
        $this->page = pagination($total, $page, $size);
        return $list;
        
    }

    public function pageHtml() {
        return $this->page;
    }
    public function getRow($uid) {
        return $this->query->from($this->tableName)->where('uid',$uid)->get();
    }
    public function upDate($date1,$uid) {
        $name = $date1['name'];
        $arr = array('sortname' => $date1['name']);
        $up = pdo_update('szxh_nmyx_activeexpirty_actionsort',$arr,array('uid' => $uid));
        return $up;
    }
    public function insertDate($da) {

        if(empty($da['name'])) {
             return message('类别名称不能为空','refresh','error');
        }
        $arr = array('sortname' => $da['name']);
        
        $sql = pdo_insert('szxh_nmyx_activeexpirty_actionsort',$arr);
    }
    public function delateDate($arr) {
        foreach ($arr as $value) {
            $del = pdo_delete('szxh_nmyx_activeexpirty_actionsort',array('uid' => $value)); 
        }
        return;
    }

}

?>